feat: add AWS infrastructure automation with Terragrunt and modular Terraform#65
Merged
Conversation
…e-commit hooks **Added:** - Introduced `infra/` directory with Terragrunt-based GOAD deployment structure, including staging environment, network, and GOAD host modules (dc01, dc02, dc03, srv02, srv03) and associated PowerShell user data templates for Windows hosts - Added `infra/goad-deployment/host-registry.yaml` as authoritative host metadata registry for GOAD infrastructure modules - Implemented generic `infra/root.hcl` and per-environment Terragrunt configs to manage S3 remote state, AWS provider, and variable inheritance - Added reusable Terraform modules: - `modules/terraform-aws-instance-factory` for flexible EC2/ASG deployments - `modules/terraform-aws-net` for VPC/subnet/network infrastructure - Added comprehensive module READMEs with usage examples and terraform-docs output - Introduced warpgate image build templates for GOAD DC/member base images and MSSQL base images, including scripts for Windows feature/role pre-installation, updates, and cleanup - Added `.hooks/linters/.tflint.hcl` to enforce Terraform linting standards - Registered pre-commit-terraform hooks for `terraform_fmt`, `terraform_validate`, and `terraform_tflint` in `.pre-commit-config.yaml` - Added Terraform patterns to `.gitignore` to prevent state/plans from being committed - Implemented new `infra` CLI command (`cli/cmd/infra_cmd.go`) to manage Terragrunt-based infra lifecycle (init, plan, apply, destroy, output, validate) - Exposed infra/terragrunt config sections and path helpers in internal config - Added Terragrunt runner and environment validation helpers under `cli/internal/terragrunt/` **Changed:** - Enhanced `.github/workflows/pre-commit.yaml` to install and initialize Terraform, TFLint, and Terragrunt as part of CI for pre-commit checks - Extended `.gitignore` for Terraform state, plan, and lock files - Registered pre-commit-terraform repo and hooks in `.pre-commit-config.yaml` - Updated internal config (`cli/internal/config/config.go`) to support infra deployment/terragrunt path resolution and environment defaults - Added Terragrunt and Terraform/Tofu checks to `cli/internal/doctor/checks.go` for `doctor` command to validate prerequisites - Set default infra config values in `cli/internal/config/defaults.go` **Removed:** - None (all additions are new functionality and structure)
…ders to extensions **Added:** - Implemented lab discovery and listing utilities, including a new `lab list` command for enumerating labs, providers, and hosts - Added the ability to control (start, stop, restart, destroy) individual lab VMs by hostname via new subcommands (`start-vm`, `stop-vm`, etc.) - Introduced new AWS client methods for discovering all instances (including stopped), finding by hostname in any state, and terminating VMs - Added functions to resolve playbooks for a lab, resume provisioning from a specific playbook, and ensure variant generation during provisioning **Changed:** - Refactored provisioning logic to support the `--from` flag for resuming from a specified playbook and to use lab-specific playbook resolution - Updated the extensions provider path logic to use `extensions/` directory instead of `providers/` for extension provider configs - Updated the logic for generating variants to be more robust and reusable **Removed:** - Removed the `providers/` directory and migrated all extension resources to `extensions/`, updating all references accordingly - Removed indirect dependency on `go.yaml.in/yaml/v3` from `go.mod` (now direct)
**Changed:** - Suppress potential error from file close operation in the output writer's cleanup function by assigning the result to the blank identifier. This prevents unhandled error warnings and aligns with idiomatic Go practices when the error is not actionable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Changes:
extensions/directory structureinfracommands and lab discovery/listing featuresAdded:
modules/terraform-aws-instance-factoryfor flexible EC2/ASG/LB deploymentsmodules/terraform-aws-netfor multi-AZ VPC, subnets, NAT, and VPC endpointsinfra/goad-deploymentwith host registry, environment, region, and host definitionscli/cmd/infra_cmd.gofordreadgoad infracommands (init, plan, apply, destroy, output, validate)cli/cmd/lab_list.gofor listing available labs and their providers/hostsstart-vm,stop-vm,restart-vm,destroy-vm)internal/terragruntpackage for orchestration and environment validationinternal/lab/discovery.gofor lab and playbook enumerationwarpgate-templates/goad-dc-base,goad-dc-base-2016,goad-member-base-2016,goad-mssql-basewith provisioning scripts and docsChanged:
InfraConfigstruct for deployment, terragrunt/terraform binary paths, and default regionextensions/directoryinfra.deployment, binaries) indefaults.go.gitignoreto exclude Terraform state, plans, and lock filesdoctorchecks for Terragrunt and Terraform/Tofu binariesRemoved:
providers/directory for extensions; all are now underextensions/for consistencyThis PR introduces a modular, automated AWS infrastructure-as-code approach for GOAD labs, supporting full lifecycle management via Terragrunt and a modernized CLI. It enables rapid, repeatable lab deployments, strict infra validation, and seamless future extensibility.